Skip to content

feat: add stats/incr/nanmidrange#6149

Merged
Planeshifter merged 11 commits into
stdlib-js:developfrom
jalajk3004:nanmidrange
Jul 7, 2026
Merged

feat: add stats/incr/nanmidrange#6149
Planeshifter merged 11 commits into
stdlib-js:developfrom
jalajk3004:nanmidrange

Conversation

@jalajk3004

Copy link
Copy Markdown
Contributor

Resolves #5578

Description

What is the purpose of this pull request?

This pull request:

  • adds a package nanmidrange, which works like midrange in which it calculates midrange incrementally ignoring NaN values

Related Issues

Does this pull request have any related issues?

This pull request:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.


@stdlib-js/reviewers

@stdlib-bot stdlib-bot added Statistics Issue or pull request related to statistical functionality. Needs Review A pull request which needs code review. Good First PR A pull request resolving a Good First Issue. labels Mar 18, 2025
@stdlib-bot

stdlib-bot commented Mar 18, 2025

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
stats/incr/nanmidrange $\\color{green}134/134$
$\\color{green}+0.00\\%$
$\\color{green}7/7$
$\\color{green}+0.00\\%$
$\\color{green}2/2$
$\\color{green}+0.00\\%$
$\\color{green}134/134$
$\\color{green}+0.00\\%$

The above coverage report was generated for the changes in this PR.

@Planeshifter Planeshifter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR! I left some review comments; better later than never, I thought.

@@ -0,0 +1,63 @@
/*

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should be named test.ts (lowercase), not Test.ts. The stdlib convention is to use only lowercase letters, numbers, and underscores in filenames. If you look at the reference @stdlib/stats/incr/midrange/docs/types/, the file is test.ts.

* ## Notes
*
* - The mid-range is the arithmetic mean of maximum and minimum values. Accordingly, the mid-range is the midpoint of the range and a measure of central tendency.
* - If provided `NaN` or a value which, when used in computations, results in `NaN`, the accumulated value is `NaN` for all future invocations.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This note was carried over from the non-nan incrmidrange type definition, but it's incorrect here. The whole point of nanmidrange is that NaN values are ignored, not propagated. This line tells users the exact opposite of what the function does.

We should remove this note entirely.

@Planeshifter Planeshifter added Needs Changes Pull request which needs changes before being merged. and removed Needs Review A pull request which needs code review. labels Feb 12, 2026
@Planeshifter Planeshifter dismissed their stale review July 7, 2026 04:51

Requested changes applied in the maintainer cleanup commit: renamed Test.ts to test.ts and removed the incorrect NaN note in index.d.ts. Dismissing the stale review.

@Planeshifter Planeshifter requested a review from a team July 7, 2026 04:51
@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Jul 7, 2026
- Rename docs/types/Test.ts to test.ts so the TypeScript type test is picked up on case-sensitive filesystems
- Remove the incorrect NaN-propagation note from index.d.ts (the accumulator ignores NaN)
- Correct the accumulator JSDoc @returns type to (number|null)
- Drop backticks from package.json description; add nan/ignore keywords
- Simplify examples output and guard against a null accumulated value
- Bump copyright year to 2026

@Planeshifter Planeshifter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's land it.

@Planeshifter Planeshifter added the Ready To Merge A pull request which is ready to be merged. label Jul 7, 2026
@stdlib-bot stdlib-bot removed Needs Review A pull request which needs code review. Needs Changes Pull request which needs changes before being merged. labels Jul 7, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

PR Commit Message

feat: add `stats/incr/nanmidrange`

PR-URL: https://github.com/stdlib-js/stdlib/pull/6149
Closes: https://github.com/stdlib-js/stdlib/issues/5578

Co-authored-by: Philipp Burckhardt <pburckhardt@outlook.com>
Reviewed-by: Philipp Burckhardt <pburckhardt@outlook.com>

Please review the above commit message and make any necessary adjustments.

@Planeshifter Planeshifter merged commit 7e865ae into stdlib-js:develop Jul 7, 2026
32 checks passed
@stdlib-bot stdlib-bot removed the Ready To Merge A pull request which is ready to be merged. label Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Good First PR A pull request resolving a Good First Issue. Statistics Issue or pull request related to statistical functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RFC]: add stats/incr/nanmidrange

3 participants